package com.star.controller;

import com.star.service.FriendLinkService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * 友链显示控制器
 *
 * @author tanyapeng
 * @date 2021/2/5
 */
@Controller
public class FriendsShowController {

    @Resource
    private FriendLinkService friendLinkService;

    /**
     * 获取所有友链并跳转
     *
     * @param model
     * @return
     */
    @GetMapping("/friends")
    public String friends(Model model) {
        model.addAttribute("friendlinks", friendLinkService.listFriendLink());
        return "friends";
    }

}